﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CloudPms.Common.Utils
{
    /// <summary>
    /// 夜审代码
    /// </summary>
    public class NightAuditCode
    {
        /// <summary>
        /// 夜审状态 
        /// </summary>
        public enum Status
        {
            /// <summary>
            /// 夜审开始(Start)
            /// </summary>
            S=0x1,
            /// <summary>
            /// 夜审中(Doing)
            /// </summary>
            I=0x2,
            /// <summary>
            /// 夜审异常(Exception)
            /// </summary>
            E=0x4,
            /// <summary>
            /// 夜审完成(Complete)
            /// </summary>
            C=0x8
        }

        /// <summary>
        /// 夜审步骤 存在缓存中
        /// </summary>
        public enum Steping
        {
            /// <summary>
            /// 1 检查准备
            /// </summary>
            ReadyCheck=1,
            /// <summary>
            /// 2 收取房租
            /// </summary>
            RentRoll=2,
            /// <summary>
            /// 3 科目汇总
            /// </summary>
            LedgerTotal = 3,
            /// <summary>
            /// 4 客账结余
            /// </summary>
            AccountRemain = 4,
            /// <summary>
            /// 5 营业状态
            /// </summary>
            OperationStatus = 5,
            /// <summary>
            /// 6 经营分析
            /// </summary>
            OperationAnalysis = 6,
            /// <summary>
            /// 7 账目更新 (IsRentRoll=true)
            /// </summary>
            UpdateBill = 7,
            /// <summary>
            /// 8 标记脏房 (OC => OD)
            /// </summary>
            AlterDirtyRoom = 8,
            /// <summary>
            /// 9 营业日变更 完成夜审通知打印单据等
            /// </summary>
            CompleteAudit = 9
        }


        /// <summary>
        /// 读取夜审出错信息
        /// </summary>
        /// <param name="steping"></param>
        /// <returns></returns>
        public static string ReadExceptionDescription(Steping steping)
        {
            string ex = "未知错误";

            switch(steping)
            {
                case Steping.ReadyCheck:
                    ex = "预检查未通过";
                    break;
                case Steping.RentRoll:
                    ex = "过租(滚房费)异常";
                    break;
                case Steping.LedgerTotal:
                    ex = "科目汇总异常";
                    break;
                case Steping.AccountRemain:
                    ex = "客账结余异常";
                    break;
                case Steping.OperationStatus:
                    ex = "营业状态快照异常";
                    break;
                case Steping.OperationAnalysis:
                    ex = "经营分析异常";
                    break;
                case Steping.UpdateBill:
                    ex = "账目夜审标记设置失败";
                    break;
                case Steping.AlterDirtyRoom:
                    ex = "脏房标记更新失败";
                    break;
                case Steping.CompleteAudit:
                    ex = "完成夜审异常：翻转营业日失败";
                    break;
            }

            return ex;

        }
    }
}
